#ifndef COMMUNICATIONITEM_H
#define COMMUNICATIONITEM_H

#include <QWidget>
#include <QMouseEvent>
#include <QDateTime>
namespace Ui {
class CommunicationItem;
}

class CommunicationItem : public QWidget
{
    Q_OBJECT

public:
    explicit CommunicationItem(const QString &email,const QString &name,const QString &newInfo,QWidget *parent = nullptr);
    explicit CommunicationItem(const QString &email,const QString &name,const QString &newInfo,const QString &time,QWidget *parent = nullptr);
    ~CommunicationItem();

    QString getEmail();
    QWidget* getPage();
    QString getUsername();

    void setPage(QWidget* cpage);
    void setHeadImg();
    void setNormalStyle();
    void setClickedStyle();
    void setNewInfo(QString text,QString newDate);
signals:
    void clicked(CommunicationItem* cItem,QWidget* cpage);
    void closeClicked(QWidget* item,QWidget* page);
protected:
    void mousePressEvent(QMouseEvent* event);
private:
    Ui::CommunicationItem *ui;
    QString email;
    QWidget* cpage;
};

#endif // COMMUNICATIONITEM_H
